import http from "@/utils/fetch";
import qs from 'qs';

/**
 * 订单管理
 */
// 订单列表
export function orderList(params) {
  return http.post("/Admin/Order/orderList", params);
}
// 查看租期
export function getLease(orderId) {
  return http.post("/Admin/Order/getLease", { orderId });
}
// 设置修改收货地址
export function setAddress(params) {
  return http.post("/Admin/Order/setAddress", params, true);
}
// 获取所有区域
export function getRegion() {
  return http.post("/Admin/Order/getRegion");
}
// 添加设备编号
export function setDeviceNumber(params) {
  return http.post("/Admin/Order/setDeviceNumber", params, true);
}
// 添加客服备注
export function setOrderRemark(params) {
  return http.post("/Admin/Order/setOrderRemark", params, true);
}
// 获取客服备注记录
export function getOrderRemark(params) {
  return http.post("/Admin/Order/getOrderRemark", params);
}
// 查看流水记录
export function getLeaseFlow(orderNo) {
  return http.post("/Admin/Order/getLeaseFlow", { orderNo });
}
// 获取物流公司列表
export function getLogisticAll() {
  return http.post("/Admin/Order/getLogisticAll");
}
// 发货
export function deliverGoods(params) {
  return http.post("/Admin/Order/deliverGoods", params, true);
}
// 确认收货
export function confirmGoods(params) {
  return http.post("/Admin/Order/confirmGoods", params, true);
}
// 获取剩余押金
export function getSurplusDeposit(orderId) {
  return http.post("/Admin/Order/getSurplusDeposit", { orderId });
}
// 扣除押金
export function deductDeposit(params) {
  return http.post("/Admin/Order/deductDeposit", params, true );
}
// 获取账单详情
export function getLeaseInfo(orderId) {
  return http.post("/Admin/Order/getLeaseInfo", { orderId });
}
// 获取物流信息
export function getLogisticInfo(params) {
  return http.post("/Admin/Order/getLogisticInfo", params);
}
// 补充发货确认收货凭证
export function setOrderVoucher(params) {
  return http.post("/Admin/Order/setOrderVoucher", params, true);
}
// 获取订单状态列表
export function getOrderStatus() {
  return http.post("/Admin/Order/getOrderStatus");
}
// 订单列表导出
export function orderListExport(params) {
  return http.export("/Admin/Order/orderListExport", params, "订单列表");
}
// 花呗订单列表
export function orderHuaBeiList(params) {
  return http.post("/Admin/Order/orderHuaBeiList", params);
}
// 花呗订单列表-导出
export function orderHuaBeiExport(params) {
  return http.export("/Admin/Order/orderHuaBeiExport", params, "花呗订单列表");
}
// 买断订单列表
export function orderBuyOutList(params) {
  return http.post("/Admin/Order/orderBuyOutList", params);
}
// 买断订单列表-导出
export function orderBuyOutListExport(params) {
  return http.export(
    "/Admin/Order/orderBuyOutListExport",
    params,
    "买断订单列表"
  );
}
// 签约待付款订单列表
export function orderSignedList(params) {
  return http.post("/Admin/Order/orderSignedList", params);
}
// 到期提醒
export function orderRemindList(params) {
  return http.get("/Admin/Order/orderRemindList", params);
}
// 到期提醒-导出
export function orderRemindListExport(params) {
  return http.export(
    "/Admin/Order/orderRemindListExport",
    params,
    "到期提醒订单列表"
  );
}
// 签约待支付订单列表-导出
export function orderSignedListExport(params) {
  return http.export(
    "/Admin/Order/orderSignedListExport",
    params,
    "签约待支付订单列表"
  );
}
// 交易完成
export function orderFinish(orderId) {
  return http.post("/Admin/Order/orderFinish", { orderId }, true);
}
// 订单同意归还
export function orderReturnAgree(orderId) {
  return http.post("/Admin/Order/orderReturnAgree", { orderId }, true);
}
// 订单归还审核拒绝
export function orderReturnRefuse(params) {
  return http.post("/Admin/Order/orderReturnRefuse", params, true);
}
// 订单确认归还
export function orderComfirmReturn(orderId) {
  return http.post("/Admin/Order/orderComfirmReturn", { orderId }, true);
}
// 订单归还完成
export function orderReturnFinish(orderId) {
  return http.post("/Admin/Order/orderReturnFinish", { orderId }, true);
}
// 订单关闭
export function orderClose(orderId) {
  return http.post("/Admin/Order/orderClose", { orderId }, true);
}
// 导出签收凭证word
export function downloadWord(params) {
	const baseURL = `${process.env.VUE_APP_BASE_API}`;
	const url = '/Download/Order/express';
	const paramsObj = { ...params, export: true };
	const paramsStr = `?${qs.stringify(paramsObj)}`;
	console.log(baseURL + url + paramsStr);
	window.location.href = baseURL + url + paramsStr;
}
// 查看全景雷达风控数据
export function getRadarData(params) {
  return http.post("/Admin/Order/getRadarData", params,true);
}
// 查看布尔风控风控数据
export function getRiskData(params) {
  return http.post("/Admin/Order/getRiskData", params,true);
}
// 更改商户
export function editOrderData(params){
	return http.post("/Admin/Order/editOrderData",params,true);
}
// 获取供应商数据
export function getShopUser(params){
	return http.post("/Admin/Order/getShopUser");
}
// 续租订单列表
export function orderRenewalList(params){
  return http.post("/Admin/Order/orderRenewalList", params)
}
// 修改订单物流信息
export function editOrderExpress(params){
  return http.post("/Admin/Order/editOrderExpress", params, true)
}
// 风控列表
export function orderSuccessList(params) {
  return http.post("/Admin/Order/orderSuccessList", params);
}
// 查询学历
export function getEduData(params) {
  return http.post("/Admin/Order/getEduData", params,true);
}

// 获取订单编辑数据
export function getOrderData(){
	return http.post("/Admin/Order/getOrderData");
}

// 获取每期租金
export function getLeaseRent(orderId) {
  return http.post("/Admin/Order/getLeaseRent", { orderId });
}
// 征信
export function getCreditData(orderId) {
  return http.post("/Admin/Order/getCreditData", { orderId });
}
// 征信
export function getCreditData2(orderId) {
  return http.post("/Admin/Order/getCreditData2", { orderId });
}
// 签署担保合同
export function createCreditCompany(orderId){
	return http.post("/Admin/Order/setCreditData",{orderId});
}
// // 查看租期
// export function getLease(orderId) {
//   return http.post("/Admin/Order/getLease", { orderId });
// }
// 征信订单列表
export function creditOrderList(params) {
  return http.post("/Admin/Order/creditOrderList", params);
}
// 上征信1
export function setCreditData(orderId) {
  return http.post("/Supplier/Order/setCreditData", { orderId });
}
// 上征信2
export function setCreditData2(params) {
  return http.post("/Supplier/Order/setCreditData2", params);
}